<template>
  <el-container>
    <!--查询条件开始-->
    <el-header height="1">
      <venus-form
        :venus-form-items="venusFormItems.queryFormItems"
        :parms-value="parmsValue.queryParmsValue"
        :form="form.queryForm"
      />
    </el-header>
    <!--查询条件结束-->
    <!--列表开始-->
    <el-main>
      <table-pagination
        :table-data="table.tableData"
        :table-header-config="table.tableHeaderConfig"
        :total="table.total"
        :page-size="table.pageSize"
        :now-page="table.nowPage"
        :operation-config="table.operationConfig"
        @current-change="currentChange"
      />
      <table-pagination
        :table-data="table.tableData2"
        :table-header-config="table.tableHeaderConfig"
        :total="table.total2"
        :page-size="table.pageSize2"
        :now-page="table.nowPage2"
        :operation-config="table.operationConfig"
        @current-change="currentChange2"
      />
    </el-main>
    <!--列表结束-->
  </el-container>
</template>

<script>
  import dictionary from '@/dictionary'
  import { formItems } from '@/utils/formItems'
  import Vue from 'vue'

  export default {
    data() {
      return {
        dict: Vue.filter('dict'),
        table: {
          tableData: [],
          tableData2: [],
          tableHeaderConfig: [
            formItems.portName, formItems.peopleBankSubmitCode, formItems.prodCode, formItems.prodName,
            formItems.prodMod, formItems.acctMod, formItems.investObject, formItems.establishDate, formItems.endDate,
            formItems.prodCal, formItems.actualScale, formItems.expeRate, formItems.maxRate, formItems.riskLev,
            formItems.inputUser, formItems.runStat
          ],
          operationConfig: {
            fixed: 'left',
            width: 500,
            operationButton: [
              {
                value: '发布', func: (params) => {
                }
              },
              {
                value: '复制', func: () => this.$router.push({ path: '/prod_copy_info' })
              },
              {
                value: '修改', func: () => this.$router.push({ path: '/prod_edit_info' })
              },
              {
                value: '删除', func: () => {
                }
              },
              {
                value: '线下补录', func: () => {
                }
              },
              {
                value: '新建子产品', func: () => {
                }
              },
              {
                value: '开放日详情', func: () => {
                }
              },
              {
                value: '详情', func: () => this.$router.push({ path: '/prod_detail_info' })
              }
            ]
          },
          total: 100,
          total2: 100,
          pageSize: 10,
          pageSize2: 10,
          nowPage: 1,
          nowPage2: 1
        },
        form: {
          // 查询表单
          queryForm: {
            labelWidth: 0,
            button: [
              {
                name: '查询', type: 'success',
                click: () => {
                }
              },
              {
                name: '重置',
                type: 'reset',
                click: () => {
                  // eslint-disable-next-line no-return-assign
                  Object.keys(this.parmsValue.queryParmsValue).forEach(key => this.parmsValue.queryParmsValue[key] = '')
                }
              }, {
                name: '新增',
                type: 'success',
                click: () => this.$router.push({ path: '/prod_add_info' })
              }
            ]
          },
          // 增删改表单
          modifyForm: {
            labelWidth: 0,
            button: [{
              name: '保存',
              type: 'success',
              click: row => this.addPortFolio(row)
            }]
          }
        },
        formItemdData: {
          // 增删改字段数据源
          modifyFormItemdData: {
            t8_prod_series_name: Object.entries(dictionary.t8_prod_series_name).map(array => ({
              value: array[0],
              label: array[1]
            }))
          }
        },
        parmsValue: {
          // 查询字段值
          queryParmsValue: {
            name: '',
            code: ''
          },
          // 增删改字段值
          modifyParmsValue: {
            name: '',
            code: ''
          }
        },
        venusFormItems: {
          // 查询表单字段
          queryFormItems: [
            formItems.portCode, formItems.prodName, formItems.dateStart,
            formItems.dateEnd, formItems.prodMod, formItems.runStat, formItems.acctMod, formItems.investObject,
            formItems.incomeType
          ],
          // 增删改字段
          modifyFormItems: [
            formItems.portCode, formItems.prodName
          ]
        }
      }
    },
    // 生命周期开始
    beforeMount() {
      if (process.env.NODE_ENV === 'development') {
        const result = {
          'results': 16, 'rows': [{
            'rownumpagesql': 1,
            'id': 586,
            'port_name': 'newcih-测试',
            'peoplebank_submitcode': null,
            'prod_code': 'newcih-test1',
            'prod_name': '投组收益率曲线',
            'prod_mod': '4',
            'acct_mod': '2',
            'invest_object': '01',
            'prod_modpd': null,
            'establish_date': '20191120',
            'end_date': '20210420',
            'prod_cal': 517,
            'actual_scale': 7.878878787E9,
            'expe_rate': null,
            'min_rate': null,
            'max_rate': null,
            'run_stat': '4',
            'prod_doc_templates': null,
            'prod_kinds': null,
            'is_examine': null,
            'is_online': '1',
            'inputuser': 'newcih',
            'structprod_subject': null,
            'cooperation_org_name': null,
            'yield_banding_desc': '无',
            'is_structprod': 0,
            'level_type': null,
            'open_mod': '01',
            'regular_open_cycle': '01',
            'oth_regul_open_cyc': null,
            'irregular_open_desc': null,
            'first_open_date': '20191121',
            'is_open_in_holiday': 1,
            'open_times': 300,
            'open_period_business': '01',
            'open_peri_busi_desc': null,
            'risk_lev': '01',
            'app_freq': '7',
            'first_app_day': '20191120',
            'start_appday': '20191120',
            'end_appday': '20210420',
            'next_app_day': '1',
            't8_sys_portfol_id': 100208,
            't8_org_trustee_info_id': 28,
            'father_type': 0,
            'carry_mod': null,
            'check_inon': null,
            'is_cycle': 1,
            'accountset_code1': 'EQ001',
            'accountset_code2': null
          }, {
            'rownumpagesql': 2,
            'id': 556,
            'port_name': 'newcih',
            'peoplebank_submitcode': null,
            'prod_code': 'newcihimp2',
            'prod_name': '海通乙未6号定向资产管理计划',
            'prod_mod': '4',
            'acct_mod': '2',
            'invest_object': '02,03',
            'prod_modpd': null,
            'establish_date': '20191120',
            'end_date': '20210420',
            'prod_cal': 517,
            'actual_scale': 3.3424244E7,
            'expe_rate': null,
            'min_rate': null,
            'max_rate': null,
            'run_stat': '4',
            'prod_doc_templates': null,
            'prod_kinds': null,
            'is_examine': null,
            'is_online': '0',
            'inputuser': 'admin',
            'structprod_subject': null,
            'cooperation_org_name': null,
            'yield_banding_desc': '无',
            'is_structprod': 0,
            'level_type': null,
            'open_mod': '01',
            'regular_open_cycle': '01',
            'oth_regul_open_cyc': null,
            'irregular_open_desc': null,
            'first_open_date': '20191121',
            'is_open_in_holiday': 1,
            'open_times': 300,
            'open_period_business': '01',
            'open_peri_busi_desc': null,
            'risk_lev': '01',
            'app_freq': '7',
            'first_app_day': '20191120',
            'start_appday': '20191120',
            'end_appday': '20210420',
            'next_app_day': '1',
            't8_sys_portfol_id': 100175,
            't8_org_trustee_info_id': 28,
            'father_type': 0,
            'carry_mod': null,
            'check_inon': null,
            'is_cycle': 1,
            'accountset_code1': 'EQ001',
            'accountset_code2': null
          }, {
            'rownumpagesql': 3,
            'id': 554,
            'port_name': 'newcih',
            'peoplebank_submitcode': null,
            'prod_code': 'newcih-imp',
            'prod_name': '长江资管柳州银行1号',
            'prod_mod': '4',
            'acct_mod': '2',
            'invest_object': '01',
            'prod_modpd': null,
            'establish_date': '20191120',
            'end_date': '20210420',
            'prod_cal': 517,
            'actual_scale': 0,
            'expe_rate': null,
            'min_rate': null,
            'max_rate': null,
            'run_stat': '2',
            'prod_doc_templates': null,
            'prod_kinds': null,
            'is_examine': null,
            'is_online': '1',
            'inputuser': 'admin',
            'structprod_subject': null,
            'cooperation_org_name': null,
            'yield_banding_desc': '无',
            'is_structprod': 0,
            'level_type': null,
            'open_mod': '01',
            'regular_open_cycle': '01',
            'oth_regul_open_cyc': null,
            'irregular_open_desc': null,
            'first_open_date': '20191121',
            'is_open_in_holiday': 1,
            'open_times': 300,
            'open_period_business': '01',
            'open_peri_busi_desc': null,
            'risk_lev': '01',
            'app_freq': '7',
            'first_app_day': '20191120',
            'start_appday': '20191120',
            'end_appday': '20210420',
            'next_app_day': '1',
            't8_sys_portfol_id': 100175,
            't8_org_trustee_info_id': 28,
            'father_type': 0,
            'carry_mod': null,
            'check_inon': null,
            'is_cycle': 1,
            'accountset_code1': 'EQ001',
            'accountset_code2': null
          }, {
            'rownumpagesql': 4,
            'id': 547,
            'port_name': 'newcih到期',
            'peoplebank_submitcode': null,
            'prod_code': 'newcih-end',
            'prod_name': 'newcih到期',
            'prod_mod': '4',
            'acct_mod': '2',
            'invest_object': '01',
            'prod_modpd': null,
            'establish_date': '20200101',
            'end_date': '20230101',
            'prod_cal': 1096,
            'actual_scale': 0,
            'expe_rate': null,
            'min_rate': null,
            'max_rate': null,
            'run_stat': '0',
            'prod_doc_templates': '81',
            'prod_kinds': null,
            'is_examine': null,
            'is_online': '1',
            'inputuser': 'newcih',
            'structprod_subject': null,
            'cooperation_org_name': null,
            'yield_banding_desc': null,
            'is_structprod': 1,
            'level_type': '11',
            'open_mod': '01',
            'regular_open_cycle': '01',
            'oth_regul_open_cyc': null,
            'irregular_open_desc': null,
            'first_open_date': '20200102',
            'is_open_in_holiday': 1,
            'open_times': 365,
            'open_period_business': '01',
            'open_peri_busi_desc': null,
            'risk_lev': '01',
            'app_freq': '8',
            'first_app_day': '20200110',
            'start_appday': '20200101',
            'end_appday': '20230101',
            'next_app_day': '1',
            't8_sys_portfol_id': 100203,
            't8_org_trustee_info_id': 28,
            'father_type': null,
            'carry_mod': null,
            'check_inon': null,
            'is_cycle': 0,
            'accountset_code1': null,
            'accountset_code2': null
          }, {
            'rownumpagesql': 5,
            'id': 508,
            'port_name': 'newcih',
            'peoplebank_submitcode': null,
            'prod_code': 'newcih-copy2',
            'prod_name': 'N系第15期',
            'prod_mod': '4',
            'acct_mod': '2',
            'invest_object': '01',
            'prod_modpd': null,
            'establish_date': '20191120',
            'end_date': '20210420',
            'prod_cal': 517,
            'actual_scale': 0,
            'expe_rate': null,
            'min_rate': null,
            'max_rate': null,
            'run_stat': '0',
            'prod_doc_templates': null,
            'prod_kinds': null,
            'is_examine': null,
            'is_online': '1',
            'inputuser': 'newcih',
            'structprod_subject': null,
            'cooperation_org_name': null,
            'yield_banding_desc': '无',
            'is_structprod': 0,
            'level_type': null,
            'open_mod': '01',
            'regular_open_cycle': '01',
            'oth_regul_open_cyc': null,
            'irregular_open_desc': null,
            'first_open_date': '20191121',
            'is_open_in_holiday': 1,
            'open_times': 300,
            'open_period_business': '01',
            'open_peri_busi_desc': null,
            'risk_lev': '01',
            'app_freq': '7',
            'first_app_day': '20191120',
            'start_appday': '20191120',
            'end_appday': '20210420',
            'next_app_day': '1',
            't8_sys_portfol_id': 100175,
            't8_org_trustee_info_id': 28,
            'father_type': 0,
            'carry_mod': null,
            'check_inon': null,
            'is_cycle': 1,
            'accountset_code1': null,
            'accountset_code2': null
          }, {
            'rownumpagesql': 6,
            'id': 507,
            'port_name': 'newcih',
            'peoplebank_submitcode': null,
            'prod_code': 'newcih-feeco',
            'prod_name': 'N系第14期',
            'prod_mod': '4',
            'acct_mod': '2',
            'invest_object': '01',
            'prod_modpd': null,
            'establish_date': '20191120',
            'end_date': '20210420',
            'prod_cal': 517,
            'actual_scale': 0,
            'expe_rate': null,
            'min_rate': null,
            'max_rate': null,
            'run_stat': '2',
            'prod_doc_templates': null,
            'prod_kinds': null,
            'is_examine': null,
            'is_online': '1',
            'inputuser': 'newcih',
            'structprod_subject': null,
            'cooperation_org_name': null,
            'yield_banding_desc': '无',
            'is_structprod': 0,
            'level_type': null,
            'open_mod': '01',
            'regular_open_cycle': '01',
            'oth_regul_open_cyc': null,
            'irregular_open_desc': null,
            'first_open_date': '20191121',
            'is_open_in_holiday': 1,
            'open_times': 300,
            'open_period_business': '01',
            'open_peri_busi_desc': null,
            'risk_lev': '01',
            'app_freq': '7',
            'first_app_day': '20191120',
            'start_appday': '20191120',
            'end_appday': '20210420',
            'next_app_day': '1',
            't8_sys_portfol_id': 100175,
            't8_org_trustee_info_id': 28,
            'father_type': 0,
            'carry_mod': null,
            'check_inon': null,
            'is_cycle': 1,
            'accountset_code1': null,
            'accountset_code2': null
          }, {
            'rownumpagesql': 7,
            'id': 506,
            'port_name': 'newcih',
            'peoplebank_submitcode': null,
            'prod_code': 'newcih-fee',
            'prod_name': 'N系第13期',
            'prod_mod': '4',
            'acct_mod': '2',
            'invest_object': '01',
            'prod_modpd': null,
            'establish_date': '20191120',
            'end_date': '20210420',
            'prod_cal': 517,
            'actual_scale': 3.425332722E9,
            'expe_rate': null,
            'min_rate': null,
            'max_rate': null,
            'run_stat': '4',
            'prod_doc_templates': null,
            'prod_kinds': null,
            'is_examine': null,
            'is_online': '1',
            'inputuser': 'newcih',
            'structprod_subject': null,
            'cooperation_org_name': null,
            'yield_banding_desc': '无',
            'is_structprod': 0,
            'level_type': null,
            'open_mod': '01',
            'regular_open_cycle': '01',
            'oth_regul_open_cyc': null,
            'irregular_open_desc': null,
            'first_open_date': '20191121',
            'is_open_in_holiday': 1,
            'open_times': 300,
            'open_period_business': '01',
            'open_peri_busi_desc': null,
            'risk_lev': '01',
            'app_freq': '7',
            'first_app_day': '20191120',
            'start_appday': '20191120',
            'end_appday': '20210420',
            'next_app_day': '1',
            't8_sys_portfol_id': 100175,
            't8_org_trustee_info_id': 28,
            'father_type': 0,
            'carry_mod': null,
            'check_inon': null,
            'is_cycle': 1,
            'accountset_code1': null,
            'accountset_code2': null
          }, {
            'rownumpagesql': 8,
            'id': 493,
            'port_name': 'newcih',
            'peoplebank_submitcode': null,
            'prod_code': 'newcihcopy20',
            'prod_name': 'N系第12期',
            'prod_mod': '4',
            'acct_mod': '2',
            'invest_object': '01',
            'prod_modpd': null,
            'establish_date': '20191120',
            'end_date': '20210420',
            'prod_cal': 517,
            'actual_scale': 0,
            'expe_rate': null,
            'min_rate': null,
            'max_rate': null,
            'run_stat': '4',
            'prod_doc_templates': null,
            'prod_kinds': null,
            'is_examine': null,
            'is_online': '1',
            'inputuser': 'newcih',
            'structprod_subject': null,
            'cooperation_org_name': null,
            'yield_banding_desc': '无',
            'is_structprod': 0,
            'level_type': null,
            'open_mod': '01',
            'regular_open_cycle': '01',
            'oth_regul_open_cyc': null,
            'irregular_open_desc': null,
            'first_open_date': '20191121',
            'is_open_in_holiday': 1,
            'open_times': 300,
            'open_period_business': '01',
            'open_peri_busi_desc': null,
            'risk_lev': '01',
            'app_freq': '7',
            'first_app_day': '20191120',
            'start_appday': '20191120',
            'end_appday': '20210420',
            'next_app_day': '1',
            't8_sys_portfol_id': 100175,
            't8_org_trustee_info_id': 28,
            'father_type': 0,
            'carry_mod': null,
            'check_inon': null,
            'is_cycle': 1,
            'accountset_code1': null,
            'accountset_code2': null
          }, {
            'rownumpagesql': 9,
            'id': 478,
            'port_name': 'newcih',
            'peoplebank_submitcode': null,
            'prod_code': 'newcihcpi',
            'prod_name': 'N系第11期',
            'prod_mod': '4',
            'acct_mod': '2',
            'invest_object': '01',
            'prod_modpd': null,
            'establish_date': '20191120',
            'end_date': '20210420',
            'prod_cal': 517,
            'actual_scale': 0,
            'expe_rate': null,
            'min_rate': null,
            'max_rate': null,
            'run_stat': '0',
            'prod_doc_templates': null,
            'prod_kinds': null,
            'is_examine': null,
            'is_online': '1',
            'inputuser': 'newcih',
            'structprod_subject': null,
            'cooperation_org_name': null,
            'yield_banding_desc': '无',
            'is_structprod': 0,
            'level_type': null,
            'open_mod': '01',
            'regular_open_cycle': '01',
            'oth_regul_open_cyc': null,
            'irregular_open_desc': null,
            'first_open_date': '20191121',
            'is_open_in_holiday': 1,
            'open_times': 300,
            'open_period_business': '01',
            'open_peri_busi_desc': null,
            'risk_lev': '01',
            'app_freq': '7',
            'first_app_day': '20191120',
            'start_appday': '20191120',
            'end_appday': '20210420',
            'next_app_day': '1',
            't8_sys_portfol_id': 100175,
            't8_org_trustee_info_id': 28,
            'father_type': 0,
            'carry_mod': null,
            'check_inon': null,
            'is_cycle': 1,
            'accountset_code1': null,
            'accountset_code2': null
          }, {
            'rownumpagesql': 10,
            'id': 477,
            'port_name': 'newcih',
            'peoplebank_submitcode': null,
            'prod_code': 'newcihpnx',
            'prod_name': 'N系第10期',
            'prod_mod': '4',
            'acct_mod': '2',
            'invest_object': '01',
            'prod_modpd': null,
            'establish_date': '20191120',
            'end_date': '20240611',
            'prod_cal': 1665,
            'actual_scale': 0,
            'expe_rate': null,
            'min_rate': null,
            'max_rate': null,
            'run_stat': '0',
            'prod_doc_templates': null,
            'prod_kinds': null,
            'is_examine': null,
            'is_online': '1',
            'inputuser': 'newcih',
            'structprod_subject': null,
            'cooperation_org_name': null,
            'yield_banding_desc': '无',
            'is_structprod': 0,
            'level_type': null,
            'open_mod': '01',
            'regular_open_cycle': '01',
            'oth_regul_open_cyc': null,
            'irregular_open_desc': null,
            'first_open_date': '20191121',
            'is_open_in_holiday': 1,
            'open_times': 300,
            'open_period_business': '01',
            'open_peri_busi_desc': null,
            'risk_lev': '01',
            'app_freq': '7',
            'first_app_day': '20191120',
            'start_appday': '20191120',
            'end_appday': '20240611',
            'next_app_day': '1',
            't8_sys_portfol_id': 100175,
            't8_org_trustee_info_id': 28,
            'father_type': 0,
            'carry_mod': null,
            'check_inon': null,
            'is_cycle': 1,
            'accountset_code1': null,
            'accountset_code2': null
          }]
        }
        // eslint-disable-next-line no-return-assign
        this.table.tableData = result.rows
        this.table.total = result.results
        const result1 = {
          'results': 1,
          'rows': [{
            'rownumpagesql': 1,
            'id': 41,
            'ir_tradedate': '20200206',
            't8_prod_normrate_tag_id': 11,
            'ir_tag_name': 'test-zst',
            'ir_tag_code': '11',
            'ir_rate': '5.0000',
            'max_ir_rate': null
          }]
        }
        // eslint-disable-next-line no-return-assign
        this.table.tableData2 = result1.rows
        this.table.total2 = result1.results
      }
    },
    // 生命周期结束
    methods: {
      currentChange() {

      },
      currentChange2() {

      },
      /**
       * 新增产品系列
       */
      addProdSeries() {
        this.DialogForm({
          title: '新增产品系列',
          form: this.form.modifyForm,
          parmsValue: this.parmsValue.modifyParmsValue,
          venusFormItems: this.venusFormItems.modifyFormItems,
          formItemdData: this.formItemdData.modifyFormItemdData,
          isValied: true
        })
      }
    }
  }
</script>

